import request from '@/utils/request'
import type { DashboardStats, ChartData } from '@/types'

// 获取仪表盘统计数据
export const getDashboardStats = (): Promise<DashboardStats> => {
  return request.get('/dashboard/stats')
}

// 获取投放趋势数据
export const getDisposalTrend = (days: number = 30): Promise<ChartData> => {
  return request.get('/dashboard/disposal-trend', { params: { days } })
}

// 获取设备状态分布
export const getDeviceStatusDistribution = (): Promise<ChartData> => {
  return request.get('/dashboard/device-status')
}

// 获取收益趋势数据
export const getRevenueTrend = (days: number = 30): Promise<ChartData> => {
  return request.get('/dashboard/revenue-trend', { params: { days } })
}

// 获取用户活跃度数据
export const getUserActivity = (days: number = 30): Promise<ChartData> => {
  return request.get('/dashboard/user-activity', { params: { days } })
}

// 获取待处理任务数量
export const getPendingTasks = (): Promise<{
  pendingTasks: number
  exceptionDevices: number
  pendingWithdrawals: number
}> => {
  return request.get('/dashboard/pending-tasks')
}